package com.dyna.core.utils;

import lombok.extern.slf4j.Slf4j;

import java.util.Random;

@Slf4j
public class IdUtil extends cn.hutool.core.util.IdUtil {

    /**
     * 生成一个随机字符串
     * @param length 字符串的长度
     * @return 随机字符串
     */
    public static String generateRandomString(int length) {
        StringBuilder builder = new StringBuilder();
        Random random = new Random();
        for (int i = 0; i < length; i++) {
            builder.append((char) ('a' + random.nextInt(26)));
        }
        log.info("生成随机id:::{}", builder);
        return builder.toString();
    }

}
